﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FilteredPageReference;

namespace CustomizablePageReference
{
    /// <summary>
    /// Property customizable link collection control.
    /// </summary>
    public class PropertyCustomizableLinkCollectionControl : PropertyFilteredLinkCollectionControl
    {
        /// <summary>
        /// Gets or sets the settings.
        /// </summary>
        /// <value>
        /// The settings.
        /// </value>
        public PropertyFilteredPageReferenceSettings Settings { get; set; }

        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="PropertyCustomizableLinkCollectionControl"/> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public PropertyCustomizableLinkCollectionControl(
            PropertyFilteredPageReferenceSettings settings)
        {
            Settings = settings;
        }

        /// <summary>
        /// Initializes settings for property.
        /// </summary>
        protected virtual void InitializeSettings()
        {
            SettingsUtility.UpdateSettings(PropertyData, Settings);
        }

        /// <summary>
        /// Creates the edit controls.
        /// </summary>
        public override void CreateEditControls()
        {
            InitializeSettings();

            base.CreateEditControls();
        }
    }
}
